const webpackMerge = require("webpack-merge");
const ProcessMainWindow = require("./plugins/ProcessMainWindow");

const baseConfig = () => ({
    devServer: {
        hot: true,
        compress: true,
        host: "0.0.0.0",
        port: 3008,
        client: {
            progress: false,
            overlay: {
                errors: true,
                warnings: true,
            },
        },
    },
});

const electronConfig = () => {
    return {
        plugins: [new ProcessMainWindow()],
    };
};

module.exports = function (_, args, vueConfig) {
    const config = baseConfig();
    if (vueConfig && vueConfig.electronConfig)
        return webpackMerge.merge(config, electronConfig());
    else return config;
};
